package com.thread.executor;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import javax.swing.plaf.synth.SynthOptionPaneUI;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

public class SchedulePoolExecutorTest {

    public static void main(String[] args) {

        ScheduledThreadPoolExecutor threadPoolExecutor = new ScheduledThreadPoolExecutor(1);
        threadPoolExecutor.schedule(()->{
            System.out.println("11111");
            return 1;
        }, 5000, TimeUnit.MILLISECONDS);
        threadPoolExecutor.scheduleAtFixedRate(() -> {
            System.out.println("1111");
        }, 5000, 2000, TimeUnit.MILLISECONDS);
        threadPoolExecutor.scheduleWithFixedDelay(()->{
            System.out.println("11111");
        }, 5000, 2000, TimeUnit.MILLISECONDS);

    }

}
